package com.dragon.loan.entity;

import java.io.Serializable;
import java.util.Map;

import com.dragon.loan.StrategyInterface;

public class StrategyXSSResponse implements Serializable, StrategyInterface {
	private static final long serialVersionUID = 1502349935953746934L;
	
	private boolean ruleGeneralResult;
	// 消金
	private Double xiaoJScore;
	// 小贷
	private Double xiaoDScore;
	// 计算出来的额度
	private Double decisionLimit;
	// 分数
	private Double appscScore;
	// 等级
	private Double appscLevel;
	
	private Double decisionLimit12m;
	private Double decisionLimit18m;
	private Double decisionLimit6m;
	private Double decisionLimit24m;
	private boolean firstPass = false;
	
	private boolean goOffline = false;
	
	public Double getDecisionLimit6m() {
		return decisionLimit6m;
	}


	public void setDecisionLimit6m(Double decisionLimit6m) {
		this.decisionLimit6m = decisionLimit6m;
	}


	public static StrategyXSSResponse getStrategyXXSCResponseByMap(Map<String, Object> map) {
		StrategyXSSResponse strategyResponse = new StrategyXSSResponse();
		strategyResponse.setRuleGeneralResult(!(map.get("decision_type") == null || "拒绝".equals((String) map.get("decision_result"))));
		Object decisionObj = map.get("decision_limit");
		if(decisionObj != null){
			strategyResponse.setDecisionLimit((Double)decisionObj);
		}
		return strategyResponse;
	}
	
	
	public static StrategyXSSResponse getStrategyResponseByMap(StrategyResponse strategyResponse) {
		StrategyXSSResponse strategyXSSResponse = new StrategyXSSResponse();
		
		return strategyXSSResponse;
	}
	
	public static StrategyXSSResponse getStrategyResponseByMapNew(Map<String, Object> map) {
		StrategyXSSResponse strategyResponse = new StrategyXSSResponse();
		strategyResponse.setXiaoDScore((Double) map.get("appsc_level"));
		strategyResponse.setXiaoJScore((Double) map.get("appsc_level"));
		strategyResponse.setRuleGeneralResult(!(map.get("decision_result") == null || "拒绝".equals((String) map.get("decision_result"))));
		strategyResponse.setAppscScore((Double) map.get("appsc_score"));
		strategyResponse.setAppscLevel((Double) map.get("cust_level"));
		Object decisionObj = map.get("decision_limit");
		if(decisionObj != null){
			strategyResponse.setDecisionLimit((Double)decisionObj);
		}
		boolean goOffline = false;
		Object goOfflineObj = map.get("decision_result");
		if(goOfflineObj != null){
			String goOfflineStr = goOfflineObj.toString();
			if("Y".equals(goOfflineStr)){
				goOffline = true;
			}
		}
		strategyResponse.setGoOffline(goOffline);
		return strategyResponse;
	}
	
	public static StrategyXSSResponse getStrategyResponseByMapNewOffice(Map<String, Object> map) {
		StrategyXSSResponse strategyResponse = new StrategyXSSResponse();
		strategyResponse.setXiaoDScore((Double) map.get("appsc_level"));
		strategyResponse.setXiaoJScore((Double) map.get("appsc_level"));
		strategyResponse.setRuleGeneralResult(!(map.get("decision_result") == null || "拒绝".equals((String) map.get("decision_result"))));
		strategyResponse.setAppscScore((Double) map.get("appsc_score"));
		strategyResponse.setAppscLevel((Double) map.get("cust_level"));
		Object decisionObj = map.get("decision_limit");
		if(decisionObj != null){
			strategyResponse.setDecisionLimit((Double)decisionObj);
		}
		boolean goOffline = false;
		Object goOfflineObj = map.get("go_offline");
		if(goOfflineObj != null){
			String goOfflineStr = goOfflineObj.toString();
			if("Y".equals(goOfflineStr)){
				goOffline = true;
			}
		}
		strategyResponse.setGoOffline(goOffline);
		return strategyResponse;
	}
	
	
	public static StrategyXSSResponse getStrategyResponseByMap(Map<String, Object> map) {
		StrategyXSSResponse strategyResponse = new StrategyXSSResponse();
		strategyResponse.setXiaoDScore((Double) map.get("appsc_ybd_xd_level"));
		strategyResponse.setXiaoJScore((Double) map.get("appsc_ybd_xj_level"));
		strategyResponse.setRuleGeneralResult(!(map.get("decision_result") == null || "拒绝".equals((String) map.get("decision_result"))));
		strategyResponse.setAppscScore((Double) map.get("appsc_score"));
		strategyResponse.setAppscLevel((Double) map.get("app_cust_level"));
		boolean goOffline = false;
		Object goOfflineObj = map.get("decision_result");
		if(goOfflineObj != null){
			String goOfflineStr = goOfflineObj.toString();
			if("Y".equals(goOfflineStr)){
				goOffline = true;
			}
		}
		strategyResponse.setGoOffline(goOffline);
		Object decisionObj = map.get("decision_limit");
		if(decisionObj != null){
			strategyResponse.setDecisionLimit((Double)decisionObj);
		}
		return strategyResponse;
	}
	
	public static Double decisionLimitByTerms(Integer terms, StrategyXSSResponse strategyXSSResponse){
		if(terms == 12){
			return strategyXSSResponse.getDecisionLimit12m();
		}else if(terms == 18){
			return strategyXSSResponse.getDecisionLimit18m();
		}else if(terms == 24){
			return strategyXSSResponse.getDecisionLimit24m();
		}else if(terms == 6){
			return strategyXSSResponse.getDecisionLimit6m();
		}
		return null;
	}
	
	public Double getAppscScore() {
		return appscScore;
	}


	public void setAppscScore(Double appscScore) {
		this.appscScore = appscScore;
	}


	public Double getAppscLevel() {
		return appscLevel;
	}


	public void setAppscLevel(Double appscLevel) {
		this.appscLevel = appscLevel;
	}


	public Double getDecisionLimit() {
		return decisionLimit;
	}
	public void setDecisionLimit(Double decisionLimit) {
		this.decisionLimit = decisionLimit;
	}
	public boolean isRuleGeneralResult() {
		return ruleGeneralResult;
	}
	public void setRuleGeneralResult(boolean ruleGeneralResult) {
		this.ruleGeneralResult = ruleGeneralResult;
	}

	public Double getXiaoJScore() {
		return xiaoJScore;
	}

	public void setXiaoJScore(Double xiaoJScore) {
		this.xiaoJScore = xiaoJScore;
	}

	public Double getXiaoDScore() {
		return xiaoDScore;
	}

	public void setXiaoDScore(Double xiaoDScore) {
		this.xiaoDScore = xiaoDScore;
	}
	


	@Override
	public String toString() {
		return "StrategyXSSResponse [ruleGeneralResult=" + ruleGeneralResult + ", xiaoJScore=" + xiaoJScore
				+ ", xiaoDScore=" + xiaoDScore + ", decisionLimit=" + decisionLimit + ", appscScore=" + appscScore
				+ ", appscLevel=" + appscLevel + ", decisionLimit12m=" + decisionLimit12m + ", decisionLimit18m="
				+ decisionLimit18m + ", decisionLimit6m=" + decisionLimit6m + ", decisionLimit24m=" + decisionLimit24m
				+ ", firstPass=" + firstPass + "]";
	}


	public Double getDecisionLimit12m() {
		return decisionLimit12m;
	}

	

	public boolean isGoOffline() {
		return goOffline;
	}


	public void setGoOffline(boolean goOffline) {
		this.goOffline = goOffline;
	}


	public void setDecisionLimit12m(Double decisionLimit12m) {
		this.decisionLimit12m = decisionLimit12m;
	}


	public Double getDecisionLimit18m() {
		return decisionLimit18m;
	}


	public void setDecisionLimit18m(Double decisionLimit18m) {
		this.decisionLimit18m = decisionLimit18m;
	}


	public Double getDecisionLimit24m() {
		return decisionLimit24m;
	}


	public void setDecisionLimit24m(Double decisionLimit24m) {
		this.decisionLimit24m = decisionLimit24m;
	}


	public boolean isFirstPass() {
		return firstPass;
	}


	public void setFirstPass(boolean firstPass) {
		this.firstPass = firstPass;
	}
	
	
}
